#include <stdio.h>
#include <string.h>
#include "sash.h"


#ifndef _EVAL_UPMC

typedef enum kind_en { Nothing, Plus, Minus, Mult, Div, Integer, Real } kind_en;

typedef struct ast_st {
  enum kind_en kind;
  union {
    // for Plus, Minus, Mult, Div
    struct ast_st *left, *right; 
    // for Integer
    int num;
    //for Real
    double flo;
  };
} ast_st;


void free_ast(ast_st * ast);
ast_st * create_node(kind_en op, ast_st * left, ast_st * right);
ast_st * create_node_int(int num);
ast_st * create_node_real(double flo);
ast_st * create_ast(const char *arith_expr);

double eval_ast(ast_st * ast);

#endif
